home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-09-28 | 2.3 KB | 99 lines | [TEXT/MPS ] |
- /*
- File: ErrorAlert.c
-
- Contains: xxx put contents here xxx
-
- Version: xxx put version here xxx
-
- Copyright: © 1999 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: xxx put dri here xxx
-
- Other Contact: xxx put other contact here xxx
-
- Technology: xxx put technology here xxx
-
- Writers:
-
- (BWS) Brent Schorsch
-
- Change History (most recent first):
-
- <SP1> 7/1/99 BWS first checked in
- */
-
-
- //• ———————————————————————————————————————— Includes
-
- #include <Dialogs.h>
- #include <Processes.h>
- #include <NumberFormatting.h>
- #include <TextUtils.h>
-
- #include "ErrorAlert.h"
- #include "AppShellResources.h"
-
-
- //• ———————————————————————————————————————— Private Definitions
- //• ———————————————————————————————————————— Private Types
- //• ———————————————————————————————————————— Private Variables
-
- unsigned char gFatalErrOccuredStr[] = "\pA fatal error has occured (";
- unsigned char gErrOccuredStr[] = "\pAn error has occured (";
- unsigned char gEndParenStr[] = "\p)";
-
- //• ———————————————————————————————————————— Private Functions
- //• ———————————————————————————————————————— Public Variables
-
- //• ———————————————————— AboutBox
-
- void
- ErrorAlert(StringPtr errorStr, OSStatus errNum, Boolean shouldQuit)
- {
- Str255 titleStr;
- Str31 errorNumAsStr;
- SInt32 length = 0;
- SInt16 itemHit;
- AlertStdAlertParamRec pb;
-
- //• set up the error string with the error number
- NumToString (errNum, errorNumAsStr);
-
- if (shouldQuit)
- {
- BlockMoveData (&gFatalErrOccuredStr[1], &titleStr[1], gFatalErrOccuredStr[0]);
- length = gFatalErrOccuredStr[0];
- }
- else
- {
- BlockMoveData (&gErrOccuredStr[1], &titleStr[1], gErrOccuredStr[0]);
- length = gErrOccuredStr[0];
- }
-
- BlockMoveData (&errorNumAsStr[1], &titleStr[1+length], errorNumAsStr[0]);
- length += errorNumAsStr[0];
-
- BlockMoveData (&gEndParenStr[1], &titleStr[1+length], gEndParenStr[0]);
- length += gEndParenStr[0];
-
- titleStr[0] = length;
-
- //• set up the pb for StandardAlert
- pb.movable = false;
- pb.helpButton = false;
- pb.filterProc = nil;
- pb.defaultText = (StringPtr) kAlertDefaultOKText;
- pb.cancelText = nil;
- pb.otherText = nil;
- pb.defaultButton = kStdOkItemIndex;
- pb.cancelButton = kStdCancelItemIndex;
- pb.position = kWindowAlertPositionParentWindowScreen;
-
- StandardAlert(kAlertStopAlert, titleStr, errorStr, &pb, &itemHit);
-
- if (shouldQuit)
- ExitToShell();
- }
-